Skip to content

feat(ink-compat): add getInnerHeight and Box scroll compatibility#31

Merged
RtlZeroMemory merged 2 commits into
mainfrom
codex/ink-scroll-compat-gaps
Feb 11, 2026
Merged

feat(ink-compat): add getInnerHeight and Box scroll compatibility#31
RtlZeroMemory merged 2 commits into
mainfrom
codex/ink-scroll-compat-gaps

Conversation

@RtlZeroMemory

Copy link
Copy Markdown
Owner

Summary

This PR closes the remaining Gemini-critical Ink compatibility gaps in @rezi-ui/ink-compat by:

  • Adding getInnerHeight to the public API and measurement implementation.
  • Extending Box compatibility props for scroll behavior:
    • overflowY="scroll" (and overflow/overflowX unions updated to include scroll)
    • scrollTop / scrollLeft
    • scrollbarThumbColor
  • Wiring runtime behavior through types + reconciler conversion + layout measurement:
    • Scroll viewport behavior now responds to overflowY="scroll" + scrollTop.
    • Scroll metrics (scrollHeight, clientHeight) now account for scroll containers and borders.
  • Replacing third-party pattern smoke tests with real package compatibility tests for:
    • ink-spinner
    • ink-gradient

Before / After

Before

  • getInnerHeight was missing from exports.
  • overflowY="scroll" was not supported in Box props/types, and scrollTop/scrollbarThumbColor were not Ink-shaped in compat types.
  • Scroll container behavior did not reflect Gemini-style viewport scrolling needs.
  • Third-party compat tests used local pattern mocks, not real packages.

After

  • getInnerHeight(node) is exported and returns client/inner-height semantics (content area excluding border).
  • Box props include Ink-compatible scroll variants and fields (scroll, scrollTop, scrollbarThumbColor).
  • Reconciler conversion applies vertical scroll viewport behavior for overflowY="scroll".
  • Measurement runtime computes scroll/client metrics with scroll-container semantics and rerender updates.
  • Real third-party tests validate runtime compatibility with ink-spinner and ink-gradient.

Test Evidence

Validation run from a clean install in this branch:

  • npm ci -> PASS
  • npm run build -> PASS
  • npm test -> PASS
    • tests: 935
    • pass: 935
    • fail: 0

Added/updated targeted tests in packages/ink-compat/src/__tests__:

  • measurement.test.tsx
    • getInnerHeight correctness across rerenders.
    • overflowY="scroll" + scrollTop viewport behavior (Gemini-like case).
    • scrollbarThumbColor explicit no-op contract (accepted, non-breaking, scroll metrics unaffected).
  • props.test.ts
    • Mapping coverage for new scroll metadata fields.
  • api.surface.test.ts
    • Public export coverage for getInnerHeight.
  • compat.thirdparty.test.tsx
    • Real ink-spinner runtime frame updates.
    • Real ink-gradient Transform integration and render compatibility.
    • Third-party components in scroll-measurement container path.

Third-party packages tested

  • ink-spinner@5.0.0
  • ink-gradient@3.0.0
  • Test peer runtime for those packages in this repo: ink@4.4.1

Known unverified 3rd-party packages

Not in scope for this PR (follow-up recommended):

  • ink-text-input
  • ink-select-input
  • ink-table
  • ink-big-text
  • broader Ink ecosystem packages not listed above

Remaining Known Incompatibilities / Follow-up

  • Scroll viewport implementation currently targets Gemini-critical vertical behavior; horizontal scroll parity and full Ink DOM parity are not fully implemented.
  • scrollbarThumbColor is currently an accepted compatibility no-op in this renderer path (documented/tested contract), not a full visual scrollbar skin implementation.
  • Additional parity work may be needed for packages that rely on deeper Ink internals beyond Text/Transform/simple Box scroll semantics.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: af9ecf36a9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +127 to +128
mapped.overflowY === "scroll"
? applyVerticalScroll(childVNodes, mapped.scrollTop)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Limit vertical scroll slicing to column layouts

The new overflowY="scroll" path always applies applyVerticalScroll before rendering children, regardless of stackKind. In a row container, that child list is horizontal columns, so any positive scrollTop removes leading columns instead of vertically clipping rows (for example, two 1-line row children with scrollTop={1} will render only the second child). This makes vertical scrolling corrupt row layouts and should be gated to column flow (or replaced with axis-correct clipping).

Useful? React with 👍 / 👎.

Comment on lines +87 to +89
const h = Math.max(1, Math.round(child.estimatedHeight));
if (offset < h) break;
offset -= h;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle partial child offsets when applying scrollTop

applyVerticalScroll only skips a child when scrollTop is at least that child's full estimated height, and breaks otherwise. If the first child is multiline (height > 1), values like scrollTop={1} leave that child fully visible, so line-by-line scrolling inside a child never happens. This creates visibly incorrect viewport behavior for mixed-height content and needs partial-offset handling instead of whole-child dropping only.

Useful? React with 👍 / 👎.

@RtlZeroMemory
RtlZeroMemory merged commit 19c190a into main Feb 11, 2026
14 checks passed
@RtlZeroMemory
RtlZeroMemory deleted the codex/ink-scroll-compat-gaps branch February 19, 2026 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants